package com.mes.device.controller;

import com.mes.common.pojo.MESResult;
import com.mes.device.server.UpkeepTypeServer;
import com.mes.pojo.device.UpkeepType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 张喆
 * @Company
 * @Description
 * @Time 2024/10/18 16:27
 */
@RestController
@CrossOrigin
@RequestMapping("/upkeepType")
public class UpkeepTypeController {
    @Autowired
    private UpkeepTypeServer upkeepTypeServer;
    @GetMapping("/list")
    public MESResult list(UpkeepType upkeepType, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer limit){
        return upkeepTypeServer.queryAll(upkeepType,pageNum,limit);
    }
    @GetMapping("/getUpdate")
    public MESResult updateInfo(String upkeepTypeId){
        return upkeepTypeServer.queryById(upkeepTypeId);
    }
    @DeleteMapping("/delete")
    public MESResult deleteDevice(String upkeepTypeId){
        return upkeepTypeServer.deleteUpkeepTypeType(upkeepTypeId);
    }
    @PutMapping("/update")
    public MESResult update(@RequestBody UpkeepType upkeepType){
        return upkeepTypeServer.updateUpkeepTypeType(upkeepType);
    }
    @PostMapping("/insert")
    public MESResult insert(@RequestBody UpkeepType upkeepType){
        return upkeepTypeServer.addUpkeepType(upkeepType);
    }
}
